package com.aigis.big4.tmp.javase.thread.queue;

import com.aigis.big4.tmp.javase.thread.User;

import java.util.concurrent.BlockingQueue;

public class ProduceQueue implements Runnable {
    private String instance;
    private BlockingQueue<User> proQueue;

    public ProduceQueue(BlockingQueue proQueue) {
        this.proQueue = proQueue;
    }

    int i=0;


    @Override
    public void run() {
        while(true){
            try {
                User u=new User("小明"+i,i);
                System.out.println("生产"+u.toString());
                proQueue.put(u);
                Thread.sleep(100);
                i++;
            }catch (InterruptedException e){
                e.printStackTrace();
            }

        }

    }
}
